#include "led.h"

int led(void)
{
	int fd_led,len;
	char d7_on[2]={7,1};
	char d7_off[2]={7,0};

	char d8_on[2]={8,1};
	char d8_off[2]={8,0};

	char d9_on[2]={9,1};
	char d9_off[2]={9,0};

	char d10_on[2]={10,1};
	char d10_off[2]={10,0};

	fd_led = open("/dev/myled",O_RDWR);

	if(fd_led < 0)
	{
		perror("open /dev/myled");

		return -1;
	}

	while(1)
	{
		len = write(fd_led,d7_on,2);
		sleep(1);
		len = write(fd_led,d7_off,2);
		sleep(1);

		len = write(fd_led,d8_on,2);
		sleep(1);
		len = write(fd_led,d8_off,2);
		sleep(1);

		len = write(fd_led,d9_on,2);
		sleep(1);
		len = write(fd_led,d9_off,2);
		sleep(1);

		len = write(fd_led,d10_on,2);
		sleep(1);
		len = write(fd_led,d10_off,2);
		sleep(1);
	}

	close(fd_led);

	return 0;
}



